<?php
/**
 * Bidding
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Sponsored Brands campaign management
 *
 * Create and manage Sponsored Brands campaigns.   To learn more about Sponsored Brands campaigns, see:   - [Sponsored Brands overview](guides/sponsored-brands/overview)  - [Sponsored Brands campaign structure](guides/sponsored-brands/campaigns/structure)  - [Get started with Sponsored Brands campaigns](guides/sponsored-brands/campaigns/get-started-with-campaigns)
 *
 * OpenAPI spec version: 4.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * Bidding Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class Bidding implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'Bidding';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'bid_optimization' => 'bool',
        'bid_adjustments_by_shopper_segment' => '\AmazonAdvertisingApi\Model\BidAdjustmentByShopperSegment[]',
        'bid_adjustments_by_placement' => '\AmazonAdvertisingApi\Model\BidAdjustmentByPlacement[]',
        'bid_optimization_strategy' => '\AmazonAdvertisingApi\Model\BidOptimizationStrategy'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'bid_optimization' => null,
        'bid_adjustments_by_shopper_segment' => null,
        'bid_adjustments_by_placement' => null,
        'bid_optimization_strategy' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'bid_optimization' => 'bidOptimization',
        'bid_adjustments_by_shopper_segment' => 'bidAdjustmentsByShopperSegment',
        'bid_adjustments_by_placement' => 'bidAdjustmentsByPlacement',
        'bid_optimization_strategy' => 'bidOptimizationStrategy'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'bid_optimization' => 'setBidOptimization',
        'bid_adjustments_by_shopper_segment' => 'setBidAdjustmentsByShopperSegment',
        'bid_adjustments_by_placement' => 'setBidAdjustmentsByPlacement',
        'bid_optimization_strategy' => 'setBidOptimizationStrategy'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'bid_optimization' => 'getBidOptimization',
        'bid_adjustments_by_shopper_segment' => 'getBidAdjustmentsByShopperSegment',
        'bid_adjustments_by_placement' => 'getBidAdjustmentsByPlacement',
        'bid_optimization_strategy' => 'getBidOptimizationStrategy'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['bid_optimization'] = isset($data['bid_optimization']) ? $data['bid_optimization'] : null;
        $this->container['bid_adjustments_by_shopper_segment'] = isset($data['bid_adjustments_by_shopper_segment']) ? $data['bid_adjustments_by_shopper_segment'] : null;
        $this->container['bid_adjustments_by_placement'] = isset($data['bid_adjustments_by_placement']) ? $data['bid_adjustments_by_placement'] : null;
        $this->container['bid_optimization_strategy'] = isset($data['bid_optimization_strategy']) ? $data['bid_optimization_strategy'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets bid_optimization
     *
     * @return bool
     */
    public function getBidOptimization()
    {
        return $this->container['bid_optimization'];
    }

    /**
     * Sets bid_optimization
     *
     * @param bool $bid_optimization Whether to use automatic placement level bid optimization. If set to true, Amazon will automatically set the right placement adjustment and the bidAdjustmentsByPlacement field is ignored. If set to false, the bidAdjustmentsByPlacement field will be used to adjust bid on different placements. If this field is changed from false to true, the bidAdjustmentsByPlacement field will be reset to null.
     *
     * @return $this
     */
    public function setBidOptimization($bid_optimization)
    {
        $this->container['bid_optimization'] = $bid_optimization;

        return $this;
    }

    /**
     * Gets bid_adjustments_by_shopper_segment
     *
     * @return \AmazonAdvertisingApi\Model\BidAdjustmentByShopperSegment[]
     */
    public function getBidAdjustmentsByShopperSegment()
    {
        return $this->container['bid_adjustments_by_shopper_segment'];
    }

    /**
     * Sets bid_adjustments_by_shopper_segment
     *
     * @param \AmazonAdvertisingApi\Model\BidAdjustmentByShopperSegment[] $bid_adjustments_by_shopper_segment DEPRECATED [PLANNED SHUTOFF DATE 3/31/2024] **Note: This feature has been deprecated and planned to shutoff on 03/31/2024. After the shut off date, we will ignore this field in the request and treat it as null. You will not get an error if you supply this field in the request. Based on customer feedback, we are rethinking this feature in context to Goal based campaigns to help advertiser reach NTB customers at scale with transparent reporting. Meanwhile, if you have any feedback or suggestion related to this feature then please reach out to our customer support teams.  Shopper segment level bid adjustment. When both bidAdjustmentsByPlacement and bidAdjustmentsByShopperSegment are specified, the adjustment will be multiplicative.
     *
     * @return $this
     */
    public function setBidAdjustmentsByShopperSegment($bid_adjustments_by_shopper_segment)
    {
        $this->container['bid_adjustments_by_shopper_segment'] = $bid_adjustments_by_shopper_segment;

        return $this;
    }

    /**
     * Gets bid_adjustments_by_placement
     *
     * @return \AmazonAdvertisingApi\Model\BidAdjustmentByPlacement[]
     */
    public function getBidAdjustmentsByPlacement()
    {
        return $this->container['bid_adjustments_by_placement'];
    }

    /**
     * Sets bid_adjustments_by_placement
     *
     * @param \AmazonAdvertisingApi\Model\BidAdjustmentByPlacement[] $bid_adjustments_by_placement Placement level bid adjustment. Note that this field can only be set when 'bidOptimization' is set to false.
     *
     * @return $this
     */
    public function setBidAdjustmentsByPlacement($bid_adjustments_by_placement)
    {
        $this->container['bid_adjustments_by_placement'] = $bid_adjustments_by_placement;

        return $this;
    }

    /**
     * Gets bid_optimization_strategy
     *
     * @return \AmazonAdvertisingApi\Model\BidOptimizationStrategy
     */
    public function getBidOptimizationStrategy()
    {
        return $this->container['bid_optimization_strategy'];
    }

    /**
     * Sets bid_optimization_strategy
     *
     * @param \AmazonAdvertisingApi\Model\BidOptimizationStrategy $bid_optimization_strategy bid_optimization_strategy
     *
     * @return $this
     */
    public function setBidOptimizationStrategy($bid_optimization_strategy)
    {
        $this->container['bid_optimization_strategy'] = $bid_optimization_strategy;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
